//index.js
import naviConfigs from './navi.js';
import tabbar from '../../tabbar';
const app = getApp()

Page({
  data: {
    naviConfigs: naviConfigs,
    list:tabbar,
    bannerData:{}
  },
  onLoad: function() {
    
  },
  onShow:function(){
    //获取banner数据
    let _this=this;
    wx.request({
      url: app.globalData.onlineUrl+'/getBannerData',
      method: 'POST',
      data: {},
      header: {'content-type': 'application/json' }, // 请求头
      success: function (res) {
        console.log(123,res.data.data)
        _this.setData({
          bannerData:res.data.data
        })
      },
      fail: function (err) {
      }
    }); 
  },

  onShareAppMessage() {

  },

  onNaviCard(e) {
    let {
      title,
      navigatemark
    } = e.target.dataset;
    wx.navigateTo({
      url: '/pages/navigator/content/index?title=' + title + '&navigatemark=' + navigatemark
    });
  },

  onCard() {
    // const path = e.target.dataset.path
    wx.navigateTo({
      url: '/pages/navigator/content/index?title=电商专题&navigatemark=shopping'
    });
  },
  menuGo(e) {
    let url=""
    let index=e.target.dataset.index
    console.log(123,index);
    switch (index) {  
      case "1": 
        url= '/pages/navigator/customer/index' ;
        break;  
      case "2": 
        url= '/pages/navigator/worker/index' ;
        break;  
      case "3": 
        url= '/pages/navigator/processes/index' ; 
        break;  
      case "4":  
        url= '/pages/navigator/unit/index' ;
      break;  
      default:   
        break;  
    }
    console.log(999,url);
    wx.navigateTo({
      url: url
    });
  }
});


